package no.gnet.edvd.types;

public class Category extends Persist{
	public static Category POLITICS;
	public static Category SPORTS;
	public static Category CELEBRITIES;
	public static Category BIGEVENTS;
	public static Category THISANDTHAT;	
	public static Category NONE;
	
	static{
		POLITICS= new Category("Politics", "Anything regarding politics");
		POLITICS.id=1;
		SPORTS= new Category("Sports", "Anything regarding any sporting event");
		SPORTS.id=2;
		CELEBRITIES= new Category("Celebrities", "Anything regarding celebrities");
		CELEBRITIES.id=3;
		BIGEVENTS= new Category("Big events", "Anything regarding big events of any type");
		BIGEVENTS.id=4;	
		THISANDTHAT= new Category("THISANDTHAT", "Anything really");
		THISANDTHAT.id=5;
		NONE= new Category("No category", "No category specifies");
		NONE.id=4004;				
	}
	
	public String name;
	public String desc;

	public Category(String name, String desc) {
		super();
		this.name = name;
		this.desc = desc;	
	}
	
	public static Category getCategoryByID(int id) {
		switch (id) {
		case 1:
			return POLITICS;
		case 2:
			return SPORTS;
		case 3:
			return CELEBRITIES;
		case 4:
			return BIGEVENTS;
		case 5:
			return THISANDTHAT;
		default:
			return NONE;
		}
	}
	
	public static Category getCategoryByName(String name) {
		if (name.toUpperCase().startsWith("POLIT")) {
			return POLITICS;
		} else if (name.toUpperCase().startsWith("SPOR")) {
			return SPORTS;
		} else if (name.toUpperCase().startsWith("CELEBR")) {
			return CELEBRITIES;
		} else if (name.toUpperCase().startsWith("BIG")) {
			return BIGEVENTS;
		} else if (name.toUpperCase().startsWith("THIS")) {
			return THISANDTHAT;
		}
		return NONE;
	}	
	
}
